#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<complex>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
typedef double db;
typedef complex<double> cp;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); }
	return x*f;
}
const int MAXN=3e5+10;
int n,m;
cp x[MAXN],y[MAXN];
void FFT(int n,cp *a,int flag)
{
	if(n==1)return;
	cp a0[(n>>1)+1],a1[(n>>1)+1];
	cp omega_n(cos(2*M_PI/n),sin(flag*2*M_PI/n)),omega(1,0);
	for(int i=0;i<(n>>1);++i)a0[i]=a[i<<1],a1[i]=a[i<<1|1];
	FFT(n>>1,a0,flag);
	FFT(n>>1,a1,flag);
	for(int i=0;i<(n>>1);++i)
	{
		a[i]=a0[i]+omega*a1[i];
		a[i+(n>>1)]=a0[i]-omega*a1[i];
		omega*=omega_n;
	}
	if(flag==-1)
		for(int i=0;i<n;++i)
			x[i]=int(x[i].real()/n+0.5);
	return;
}
int main()
{
	n=read();m=read();
	for(int i=0;i<=n;++i)x[i]=read();
	for(int i=0;i<=m;++i)y[i]=read();
	m+=n;n=1;
	while(n<=m)n<<=1;
	FFT(n,x,1);
	FFT(n,y,1);
	for(int i=0;i<n;++i)x[i]=x[i]*y[i];
	FFT(n,x,-1);
	for(int i=0;i<=m;++i)printf("%d ",(int)x[i].real());
	puts("");
	return 0;
}
